/*
 * This file is a part of the RMI Plugin for Eclipse tutorials.
 * Copyright (C) 2002-7 Genady Beryozkin
 */
package oldVersion.storage;

/**
 *@author Adam
 */

import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import server.RMIServer;



/**
 * This is a simple print client.
 * 
 * @author Genady Beryozkin, rmi-info@genady.net
 */
public class RMIClient {
	
	public Storage parent;
	
	public RMIClient(Storage s){
		parent =s;
	}
	

    public void begin(String location) {
        System.setSecurityManager(new RMISecurityManager());
        try {
            Registry registry = LocateRegistry.getRegistry(location);
            RMIServer RMIServer = (RMIServer)registry.lookup("RMIServer");
            
            
            RMIServer.sendMP3s(parent.getSongs());
            
            System.out.println("Done sending Mp3s");
        } catch (Exception e) {
            // Something wrong here
            e.printStackTrace();
        }
    }
}
